package ru.spies.pages;

import ru.spies.content.DBFunctionalContent;
import ru.spies.dbfunctional.ICallFunction;
import ru.spies.help.DataTableCreator;

public class SPPage extends AbstractPage {

	private static SPPage statThis;
	
	private static final String TABLE_NAME="callSP";	
	private static final String PAGE_NAME="Специальные возможности";
	
	private ICallFunction caller=null;

	private SPPage() {
		
	}
	
	public static SPPage getInstance(ICallFunction caller){
		if (statThis==null){
			statThis = new SPPage();
		}
		statThis.setCaller(caller);
		return statThis;
	}

	@Override
	public String getThisPage() {
		return getPage(PAGE_NAME, DBFunctionalContent.getInstance().getSPTableContent(TABLE_NAME, caller.getColumns(true)), getHeadContent());
	}
	
	private String getHeadContent(){
		return DataTableCreator.getInstance(TABLE_NAME).getJSSource(caller.getColumns(false));
	}

	private void setCaller(ICallFunction caller){
		this.caller=caller;
	}
	
}
